package com.atguigu.blog.exception;

import com.atguigu.blog.utils.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author MikeCoder
 * @create 2023-11-2717:52
 * @description:
 * @verson:
 */
@RestControllerAdvice
public class BlogException {
    @ExceptionHandler(ArithmeticException.class)
    public Result exceptionHandler1(ArithmeticException exception){
        return Result.fail(null).message("算术异常");
    }
    @ExceptionHandler(Exception.class)
    public Result excepetionHandler2(Exception e){
        return Result.fail(null).message("服务器未知错误,请联系后台管理员");
    }

}
